# -*- coding: utf-8 -*-

SERVICES = {
    "tcpmux": 1,                             "search": 2010,
    "echo": 7,                               "pipe_server": 2010,
    "echo": 7,                               "nfs": 2049,
    "discard": 9,                            "nfs": 2049,
    "discard": 9,                            "gnunet": 2086,
    "systat": 11,                            "gnunet": 2086,
    "daytime": 13,                           "rtcm-sc104": 2101,
    "daytime": 13,                           "rtcm-sc104": 2101,
    "netstat": 15,                           "cvspserver": 2401,
    "qotd": 17,                              "cvspserver": 2401,
    "msp": 18,                               "venus": 2430,
    "msp": 18,                               "venus": 2430,
    "chargen": 19,                           "venus-se": 2431,
    "chargen": 19,                           "venus-se": 2431,
    "ftp-data": 20,                          "codasrv": 2432,
    "ftp": 21,                               "codasrv": 2432,
    "fsp": 21,                               "codasrv-se": 2433,
    "ssh": 22,                               "codasrv-se": 2433,
    "ssh": 22,                               "mon": 2583,
    "telnet": 23,                            "mon": 2583,
    "smtp": 25,                              "dict": 2628,
    "time": 37,                              "dict": 2628,
    "time": 37,                              "gpsd": 2947,
    "rlp": 39,                               "gpsd": 2947,
    "nameserver": 42,                        "gds_db": 3050,
    "whois": 43,                             "gds_db": 3050,
    "tacacs": 49,                            "icpv2": 3130,
    "tacacs": 49,                            "icpv2": 3130,
    "re-mail-ck": 50,                        "mysql": 3306,
    "re-mail-ck": 50,                        "mysql": 3306,
    "domain": 53,                            "nut": 3493,
    "domain": 53,                            "nut": 3493,
    "mtp": 57,                               "distcc": 3632,
    "tacacs-ds": 65,                         "distcc": 3632,
    "tacacs-ds": 65,                         "daap": 3689,
    "bootps": 67,                            "daap": 3689,
    "bootps": 67,                            "svn": 3690,
    "bootpc": 68,                            "svn": 3690,
    "bootpc": 68,                            "suucp": 4031,
    "tftp": 69,                              "suucp": 4031,
    "gopher": 70,                            "sysrqd": 4094,
    "gopher": 70,                            "sysrqd": 4094,
    "rje": 77,                               "remctl": 4373,
    "finger": 79,                            "remctl": 4373,
    "www": 80,                               "iax": 4569,
    "www": 80,                               "iax": 4569,
    "link": 87,                              "radmin-port": 4899,
    "kerberos": 88,                          "radmin-port": 4899,
    "kerberos": 88,                          "rfe": 5002,
    "supdup": 95,                            "rfe": 5002,
    "hostnames": 101,                        "mmcc": 5050,
    "iso-tsap": 102,                         "mmcc": 5050,
    "acr-nema": 104,                         "sip": 5060,
    "acr-nema": 104,                         "sip": 5060,
    "csnet-ns": 105,                         "sip-tls": 5061,
    "csnet-ns": 105,                         "sip-tls": 5061,
    "rtelnet": 107,                          "aol": 5190,
    "rtelnet": 107,                          "aol": 5190,
    "pop2": 109,                             "xmpp-client": 5222,
    "pop2": 109,                             "xmpp-client": 5222,
    "pop3": 110,                             "xmpp-server": 5269,
    "pop3": 110,                             "xmpp-server": 5269,
    "sunrpc": 111,                           "cfengine": 5308,
    "sunrpc": 111,                           "cfengine": 5308,
    "auth": 113,                             "mdns": 5353,
    "sftp": 115,                             "mdns": 5353,
    "uucp-path": 117,                        "postgresql": 5432,
    "nntp": 119,                             "postgresql": 5432,
    "ntp": 123,                              "freeciv": 5556,
    "ntp": 123,                              "freeciv": 5556,
    "pwdgen": 129,                           "ggz": 5688,
    "pwdgen": 129,                           "ggz": 5688,
    "loc-srv": 135,                          "x11": 6000,
    "loc-srv": 135,                          "x11": 6000,
    "netbios-ns": 137,                       "x11-1": 6001,
    "netbios-ns": 137,                       "x11-1": 6001,
    "netbios-dgm": 138,                      "x11-2": 6002,
    "netbios-dgm": 138,                      "x11-2": 6002,
    "netbios-ssn": 139,                      "x11-3": 6003,
    "netbios-ssn": 139,                      "x11-3": 6003,
    "imap2": 143,                            "x11-4": 6004,
    "imap2": 143,                            "x11-4": 6004,
    "snmp": 161,                             "x11-5": 6005,
    "snmp": 161,                             "x11-5": 6005,
    "snmp-trap": 162,                        "x11-6": 6006,
    "snmp-trap": 162,                        "x11-6": 6006,
    "cmip-man": 163,                         "x11-7": 6007,
    "cmip-man": 163,                         "x11-7": 6007,
    "cmip-agent": 164,                       "gnutella-svc": 6346,
    "cmip-agent": 164,                       "gnutella-svc": 6346,
    "mailq": 174,                            "gnutella-rtr": 6347,
    "mailq": 174,                            "gnutella-rtr": 6347,
    "xdmcp": 177,                            "sge_qmaster": 6444,
    "xdmcp": 177,                            "sge_qmaster": 6444,
    "nextstep": 178,                         "sge_execd": 6445,
    "nextstep": 178,                         "sge_execd": 6445,
    "bgp": 179,                              "afs3-fileserver": 7000,
    "bgp": 179,                              "afs3-fileserver": 7000,
    "prospero": 191,                         "afs3-callback": 7001,
    "prospero": 191,                         "afs3-callback": 7001,
    "irc": 194,                              "afs3-prserver": 7002,
    "irc": 194,                              "afs3-prserver": 7002,
    "smux": 199,                             "afs3-vlserver": 7003,
    "smux": 199,                             "afs3-vlserver": 7003,
    "at-rtmp": 201,                          "afs3-kaserver": 7004,
    "at-rtmp": 201,                          "afs3-kaserver": 7004,
    "at-nbp": 202,                           "afs3-volser": 7005,
    "at-nbp": 202,                           "afs3-volser": 7005,
    "at-echo": 204,                          "afs3-errors": 7006,
    "at-echo": 204,                          "afs3-errors": 7006,
    "at-zis": 206,                           "afs3-bos": 7007,
    "at-zis": 206,                           "afs3-bos": 7007,
    "qmtp": 209,                             "afs3-update": 7008,
    "qmtp": 209,                             "afs3-update": 7008,
    "z3950": 210,                            "afs3-rmtsys": 7009,
    "z3950": 210,                            "afs3-rmtsys": 7009,
    "ipx": 213,                              "font-service": 7100,
    "ipx": 213,                              "font-service": 7100,
    "imap3": 220,                            "http-alt": 8080,
    "imap3": 220,                            "http-alt": 8080,
    "pawserv": 345,                          "bacula-dir": 9101,
    "pawserv": 345,                          "bacula-dir": 9101,
    "zserv": 346,                            "bacula-fd": 9102,
    "zserv": 346,                            "bacula-fd": 9102,
    "fatserv": 347,                          "bacula-sd": 9103,
    "fatserv": 347,                          "bacula-sd": 9103,
    "rpc2portmap": 369,                      "amanda": 10080,
    "rpc2portmap": 369,                      "amanda": 10080,
    "codaauth2": 370,                        "hkp": 11371,
    "codaauth2": 370,                        "hkp": 11371,
    "clearcase": 371,                        "bprd": 13720,
    "clearcase": 371,                        "bprd": 13720,
    "ulistserv": 372,                        "bpdbm": 13721,
    "ulistserv": 372,                        "bpdbm": 13721,
    "ldap": 389,                             "bpjava-msvc": 13722,
    "ldap": 389,                             "bpjava-msvc": 13722,
    "imsp": 406,                             "vnetd": 13724,
    "imsp": 406,                             "vnetd": 13724,
    "https": 443,                            "bpcd": 13782,
    "https": 443,                            "bpcd": 13782,
    "snpp": 444,                             "vopied": 13783,
    "snpp": 444,                             "vopied": 13783,
    "microsoft-ds": 445,                     "wnn6": 22273,
    "microsoft-ds": 445,                     "wnn6": 22273,
    "kpasswd": 464,                          "rtmp": 1,
    "kpasswd": 464,                          "nbp": 2,
    "saft": 487,                             "echo": 4,
    "saft": 487,                             "zip": 6,
    "isakmp": 500,                           "kerberos4": 750,
    "isakmp": 500,                           "kerberos4": 750,
    "rtsp": 554,                             "kerberos_master": 751,
    "rtsp": 554,                             "kerberos_master": 751,
    "nqs": 607,                              "passwd_server": 752,
    "nqs": 607,                              "krb_prop": 754,
    "npmp-local": 610,                       "krbupdate": 760,
    "npmp-local": 610,                       "swat": 901,
    "npmp-gui": 611,                         "kpop": 1109,
    "npmp-gui": 611,                         "knetd": 2053,
    "hmmp-ind": 612,                         "zephyr-srv": 2102,
    "hmmp-ind": 612,                         "zephyr-clt": 2103,
    "qmqp": 628,                             "zephyr-hm": 2104,
    "qmqp": 628,                             "eklogin": 2105,
    "ipp": 631,                              "kx": 2111,
    "ipp": 631,                              "iprop": 2121,
    "exec": 512,                             "supfilesrv": 871,
    "biff": 512,                             "supfiledbg": 1127,
    "login": 513,                            "linuxconf": 98,
    "who": 513,                              "poppassd": 106,
    "shell": 514,                            "poppassd": 106,
    "syslog": 514,                           "ssmtp": 465,
    "printer": 515,                          "moira_db": 775,
    "talk": 517,                             "moira_update": 777,
    "ntalk": 518,                            "moira_ureg": 779,
    "route": 520,                            "spamd": 783,
    "timed": 525,                            "omirr": 808,
    "tempo": 526,                            "omirr": 808,
    "courier": 530,                          "customs": 1001,
    "conference": 531,                       "customs": 1001,
    "netnews": 532,                          "skkserv": 1178,
    "netwall": 533,                          "predict": 1210,
    "gdomap": 538,                           "rmtcfg": 1236,
    "gdomap": 538,                           "wipld": 1300,
    "uucp": 540,                             "xtel": 1313,
    "klogin": 543,                           "xtelw": 1314,
    "kshell": 544,                           "support": 1529,
    "afpovertcp": 548,                       "cfinger": 2003,
    "afpovertcp": 548,                       "frox": 2121,
    "remotefs": 556,                         "ninstall": 2150,
    "nntps": 563,                            "ninstall": 2150,
    "nntps": 563,                            "zebrasrv": 2600,
    "submission": 587,                       "zebra": 2601,
    "submission": 587,                       "ripd": 2602,
    "ldaps": 636,                            "ripngd": 2603,
    "ldaps": 636,                            "ospfd": 2604,
    "tinc": 655,                             "bgpd": 2605,
    "tinc": 655,                             "ospf6d": 2606,
    "silc": 706,                             "ospfapi": 2607,
    "silc": 706,                             "isisd": 2608,
    "kerberos-adm": 749,                     "afbackup": 2988,
    "webster": 765,                          "afbackup": 2988,
    "webster": 765,                          "afmbackup": 2989,
    "rsync": 873,                            "afmbackup": 2989,
    "rsync": 873,                            "xtell": 4224,
    "ftps-data": 989,                        "fax": 4557,
    "ftps": 990,                             "hylafax": 4559,
    "telnets": 992,                          "distmp3": 4600,
    "telnets": 992,                          "munin": 4949,
    "imaps": 993,                            "enbd-cstatd": 5051,
    "imaps": 993,                            "enbd-sstatd": 5052,
    "ircs": 994,                             "pcrd": 5151,
    "ircs": 994,                             "noclog": 5354,
    "pop3s": 995,                            "noclog": 5354,
    "pop3s": 995,                            "hostmon": 5355,
    "socks": 1080,                           "hostmon": 5355,
    "socks": 1080,                           "rplay": 5555,
    "proofd": 1093,                          "nsca": 5667,
    "proofd": 1093,                          "mrtd": 5674,
    "rootd": 1094,                           "bgpsim": 5675,
    "rootd": 1094,                           "canna": 5680,
    "openvpn": 1194,                         "sane-port": 6566,
    "openvpn": 1194,                         "ircd": 6667,
    "rmiregistry": 1099,                     "zope-ftp": 8021,
    "rmiregistry": 1099,                     "tproxy": 8081,
    "kazaa": 1214,                           "omniorb": 8088,
    "kazaa": 1214,                           "omniorb": 8088,
    "nessus": 1241,                          "clc-build-daemon": 8990,
    "nessus": 1241,                          "xinetd": 9098,
    "lotusnote": 1352,                       "mandelspawn": 9359,
    "lotusnote": 1352,                       "git": 9418,
    "ms-sql-s": 1433,                        "zope": 9673,
    "ms-sql-s": 1433,                        "webmin": 10000,
    "ms-sql-m": 1434,                        "kamanda": 10081,
    "ms-sql-m": 1434,                        "kamanda": 10081,
    "ingreslock": 1524,                      "amandaidx": 10082,
    "ingreslock": 1524,                      "amidxtape": 10083,
    "prospero-np": 1525,                     "smsqp": 11201,
    "prospero-np": 1525,                     "smsqp": 11201,
    "datametrics": 1645,                     "xpilot": 15345,
    "datametrics": 1645,                     "xpilot": 15345,
    "sa-msg-port": 1646,                     "sgi-cmsd": 17001,
    "sa-msg-port": 1646,                     "sgi-crsd": 17002,
    "kermit": 1649,                          "sgi-gcd": 17003,
    "kermit": 1649,                          "sgi-cad": 17004,
    "l2f": 1701,                             "isdnlog": 20011,
    "l2f": 1701,                             "isdnlog": 20011,
    "radius": 1812,                          "vboxd": 20012,
    "radius": 1812,                          "vboxd": 20012,
    "radius-acct": 1813,                     "binkp": 24554,
    "radius-acct": 1813,                     "asp": 27374,
    "msnp": 1863,                            "asp": 27374,
    "msnp": 1863,                            "csync2": 30865,
    "unix-status": 1957,                     "dircproxy": 57000,
    "log-server": 1958,                      "tfido": 60177,
    "remoteping": 1959,                      "fido": 60179,
    "cisco-sccp": 2000,
    "cisco-sccp": 2000,
}

SERVICES_BY_PORT = dict()
for _name, _port in SERVICES.iteritems() :
    SERVICES_BY_PORT.setdefault(_port, list(), )
    SERVICES_BY_PORT[_port].append(_name, )


